// Decompiled on 周六 2月 22 19:31:49 CST 2025 with Zomboid Decompiler v0.1.3 using Vineflower.
package zombie.commands.serverCommands;

import zombie.commands.CommandArgs;
import zombie.commands.CommandBase;
import zombie.commands.CommandHelp;
import zombie.commands.CommandName;
import zombie.commands.RequiredRight;
import zombie.core.raknet.UdpConnection;
import zombie.network.chat.ChatServer;

@CommandName(
    name = "servermsg"
)
@CommandArgs(
    required = {"(.+)"}
)
@CommandHelp(
    helpText = "UI_ServerOptionDesc_ServerMsg"
)
@RequiredRight(
    requiredRights = 56
)
public class ServerMessageCommand extends CommandBase {
    public ServerMessageCommand(String username, String userAccessLevel, String command, UdpConnection connection) {
        super(username, userAccessLevel, command, connection);
    }

    @Override
    protected String Command() {
        String string0 = this.getCommandArg(Integer.valueOf(0));
        if (this.connection == null) {
            ChatServer.getInstance().sendServerAlertMessageToServerChat(string0);
        } else {
            String string1 = this.getExecutorUsername();
            ChatServer.getInstance().sendServerAlertMessageToServerChat(string1, string0);
        }

        return "Message sent.";
    }
}
